package com.github.postsanf.yinian.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.constants.ACTIONs;
import com.github.postsanf.yinian.utils.SizeFormat;

public class PicBigSmallSelectActivity extends Activity implements OnClickListener {
    private long piclong;
    private TextView bigpic_tv;
    private TextView bigpic_tv_tip;
    private TextView smallpic_tv;
    private TextView smallpic_tv_tip;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_picbigsmallselect);
        initView();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bigsmall_back:
                finish();
                break;
            case R.id.bigpic:
                PublishWithLocationActivity.IsSmall = false;
                bigpic_tv.setTextColor(getResources().getColor(R.color.yncolor));
                bigpic_tv_tip.setTextColor(getResources().getColor(R.color.yncolor));
                sendBroadcast(new Intent(ACTIONs.actionUpdatePicBigSmall));
                finish();
                break;
            case R.id.smallpic:
                PublishWithLocationActivity.IsSmall = true;
                smallpic_tv.setTextColor(getResources().getColor(R.color.yncolor));
                smallpic_tv_tip.setTextColor(getResources().getColor(R.color.yncolor));
                sendBroadcast(new Intent(ACTIONs.actionUpdatePicBigSmall));
                finish();
                break;
        }
    }

    private void initView() {
        findViewById(R.id.bigsmall_back).setOnClickListener(this);
        bigpic_tv = (TextView) findViewById(R.id.bigpic_tv);
        smallpic_tv = (TextView) findViewById(R.id.smallpic_tv);
        bigpic_tv_tip = (TextView) findViewById(R.id.bigpic_tv_tip);
        smallpic_tv_tip = (TextView) findViewById(R.id.smallpic_tv_tip);
        findViewById(R.id.bigpic).setOnClickListener(this);
        findViewById(R.id.smallpic).setOnClickListener(this);
        piclong = getIntent().getLongExtra("upstorge", 0);
        bigpic_tv.setText("原图 (" + SizeFormat.formatSize(piclong) + ")");
        smallpic_tv.setText("正常 (" + SizeFormat.formatSize(piclong * 6 / 10) + ")");
    }

}
